package com.zscbw.test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Constructor2 {
	public Constructor2() {

	}
	public Constructor2(int a, int b) {
		System.out.println("a = " + a + " , b = " + b);
	}
	public static void main(String[] args) {
		try {
			Class<?> cls = Class.forName("com.zscbw.test.Constructor2");
			Class[] parTypes = new Class[2];
			parTypes[0] = Integer.TYPE;
			parTypes[1] = Integer.TYPE;
			Constructor[] cons = cls.getConstructors();
			Constructor c = cls.getConstructor(parTypes);
			Object[] argList = new Object[2];
			argList[0] = new Integer(37);
			argList[1] = new Integer(47);
			Object retObj = c.newInstance(argList);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
